<?php

namespace App\Modules\Manage\Model;

use Illuminate\Database\Eloquent\Model;
use DB;

class PigFileUploadModel extends Model
{
    protected $table = 'pig_file';
    protected $primaryKey = 'id';

    protected $fillable = [
        'id','product_id','sort','file_path'
    ];
    public $timestamps = false;

    static function fileInsert($data)
    {
//        return $data;
        $result = self::create($data);
        return $result;
    }

    static function fileGet($product_id)
    {
        $results = self::where('product_id',$product_id)->select('id','sort','file_path')->get();
        if ($results) {
            $results = $results->toArray();
        }
        return $results;
    }

    static function fileDel($id)
    {
        $result = self::where('id',$id)->delete();
        return $result;
    }
}